﻿@page
@using SXFramWork.Web
@{
    ViewData["Title"] = "错误日志";
    Layout = AdminLayout.Pjax(HttpContext);
}
    <div id="container">
        <style>
            .logtype li a {
                display: block;
                padding: 10px 20px;
            }

            .logtype li.active a {
                background-color: #f3f7f9;
                color: #409eff;
            }
        </style>


        <div class="layui-col-220">
            <div class="layui-nav-title">错误日志列表</div>
            <ul class="logtype" id="app">
              
                <li :class="index==active?'active':''" v-for="(it,index) in list" v-cloak @@click="gotype(index,it)"><a href="javascript:void(0)">{{it.name}}</a></li>
            </ul>
        </div>
        <div class="right-col-body">
            <div class="list-wall">
                <textarea style="border:0;border-radius:5px;background-color:rgba(234,237,241,.98);padding: 15px;resize: none;" rows="50" id="txt" cols="120"></textarea>
            </div>
        </div>

        <script>
            var fun, vm = new Vue({
                el: '#app',
                data: {
                    list: [
                        //{ name: '2020-5', content: '' },
                     
                    ],
                    active: 0
                },
                methods: {
                    gotype: function (index, m) {
                        this.active = index;
                        this.model = m;
                        fun.reload();
                    }
                }
            });
            layui.use(['layer', 'jquery', 'common'],
                function () {
                    var layer = layui.layer,
                        $ = layui.jquery,
                        os = layui.common;
                    //加载日志信息
                    os.ajax('api/admin/syserrorlog/geterrorlog/', {}, function (res) {
                        vm.list = res.data;
                        $("#txt").val(vm.list[0].content);
                    }, 'get');
                    fun = {
                        reload: function () {
                            $("#txt").val(vm.list[vm.active].content);
                        },
                    }
                });
        </script>

    </div>
